package com.guet.mapper;

import com.github.pagehelper.Page;
import com.guet.Entity.Notification;
import com.guet.Entity.NotificationDraft;
import com.guet.VO.NotificationVO;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.Map;

@Mapper
public interface NotificationMapper {
    Page<NotificationVO> list(Map map);

    @Select("select * from notification_draft where user_id = #{userId}")
    NotificationDraft queryDraftByUserId(Long userId);

    void save(NotificationDraft draft);

    @Delete("delete from notification_draft where user_id = #{userId}")
    void deleteDraftByUserId(Long userId);

    /**
     * 发布通知公告
     * @param notification
     */
    void insert(Notification notification);

    @Delete("delete from notification where id = #{id}")
    void delete(String id);
}
